<template>
	<!--日志详情-->
	<el-dialog :title="title" :visible.sync="dialogVisible" size="large" :close-on-press-escape="false" :before-close="off" :top="dialog_margin_top">

		  <div v-for="item in details">
		  	<div class="grid-content bg-purple">【步骤 {{item.step}}】{{item.operation}}</div><br>
		  	<el-row type="flex" class="row-bg" justify="space-around">
			  	<el-col :span="22">
				  	{{item.description}}
			  	</el-col>
			</el-row>
		  	<br>
		  </div>

		  <span slot="footer" class="dialog-footer">
			   <el-button @click="off">关 闭</el-button>
		  </span>
	</el-dialog>
</template>

<script>

import LogAPI from "../../../js/production/log/logAPI"

  export default {
	data() {
		return {
			dialogVisible: true,
			logId : '',
			logInfo : {},
			title: '',
			details: [],
			dialog_margin_top: '2%',
		}
	},
	mounted() {
		this.logId = this.$parent.formData.logId;
		LogAPI.logDetail(this);
		this.title = "【" + this.logInfo.operationtype + "】详情";

		let content = this.logInfo.content.split(";");
		for (let i = 0; i < content.length; i++) {
			if (content[i] !== null && content[i] !== '' && typeof content[i] !== 'undefined') {
				this.details.push({
					step: i + 1,
					operation: content[i].substring(0, content[i].indexOf(":")),
					description:  content[i].substring(content[i].indexOf("{") + 1, content[i].indexOf("}"))
				});
			}
		}

	},
	methods: {
		off() {
			this.$parent.showLogDetailDialog = false;
		}
	}
  }
</script>